package utils;
 
import entitys.Usuario;
import java.util.Date;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author Amauri
 */
public class Implantacao {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("TrabalhoFinal");
        EntityManager em = emf.createEntityManager();
        
        em.getTransaction().begin();
        
        Usuario u = new Usuario();
        u.setNome("Administrador");
        u.setCpf("000.000.000-00");
        u.setDataNascimento(new Date());
        u.setIsAdmin(true);
        u.setIsJogador(false);
        u.setSenha(CriptografiaMD5.criptografar("123"));
        u.setUsuario("admin");
        
        em.persist(u);
        
        em.getTransaction().commit();
        
        em.close();
        emf.close();
        
    }
    
}
